import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import menu from './modules/menu'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    menu
  },
  getters
})

export default store
// import Vue from 'vue'
// import Vuex from 'vuex'
// import getters from './getters'

// Vue.use(Vuex)

// const req = require.context('./modules', false, /\.js$/)
// console.log(req, 'req')
// console.log(req.keys(), 'keys') // ['./app.js', './settings.js', './user.js']
// console.log(req.keys().map(req), 'map-keys')
// console.log(req.keys().map(item => item.split('./')[1]).map(item => item.split('.')[0]))
// const mName = req.keys().map(item => item.split('./')[1]).map(item => item.split('.')[0])
// const mContent = req.keys().map(req)

// const obj = {}
// mName.forEach((key, index) => {
//   obj[key] = mContent[index].default
// })
// console.log(obj)

// const store = new Vuex.Store({
//   modules: obj,
//   getters
// })

// export default store
